Implement lazy extended input initialization on Win32, by Robert Ögren.
authorTor Lillqvist <tml@novell.com>
Wed, 2 Feb 2005 18:11:17 +0000 (18:11 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Wed, 2 Feb 2005 18:11:17 +0000 (18:11 +0000)
2005-02-02  Tor Lillqvist  <tml@novell.com>

Implement lazy extended input initialization on Win32, by Robert
Ögren. Fixes #163163, possibly #162334. Lazy initialization would
be a good idea in any case even if it didn't fix any visible
problems, though.

The Wacom tablet driver seems to get confused if Wintab is
initialized but no window is shown before the process exits. This
is the case for some GIMP plug-ins, for instance.

* gdk/win32/gdkinput-win32.c (_gdk_input_wintab_init_check): Made
non-static (and renamed).
(_gdk_input_init): Don't call _gdk_input_wintab_init_check().

* gdk/win32/gdkinput-win32.h: Declare _gdk_input_wintab_init_check().

* gdk/win32/gdkinput.c (gdk_devices_list,
gdk_display_list_devices, gdk_input_set_extension_events): Call
_gdk_input_wintab_init_check() here instead.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gdk/win32/gdkinput-win32.c
gdk/win32/gdkinput-win32.h
gdk/win32/gdkinput.c

index 04f5c86a73f36c71f3260de9d3c5039c9e539fa2..74841d4f8460c8156433588953f64d90e2b5530c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2005-02-02  Tor Lillqvist  <tml@novell.com>
+
+       Implement lazy extended input initialization on Win32, by Robert
+       Ögren. Fixes #163163, possibly #162334. Lazy initialization would
+       be a good idea in any case even if it didn't fix any visible
+       problems, though.
+
+       The Wacom tablet driver seems to get confused if Wintab is
+       initialized but no window is shown before the process exits. This
+       is the case for some GIMP plug-ins, for instance. 
+
+       * gdk/win32/gdkinput-win32.c (_gdk_input_wintab_init_check): Made
+       non-static (and renamed).
+       (_gdk_input_init): Don't call _gdk_input_wintab_init_check().
+
+       * gdk/win32/gdkinput-win32.h: Declare _gdk_input_wintab_init_check().
+
+       * gdk/win32/gdkinput.c (gdk_devices_list,
+       gdk_display_list_devices, gdk_input_set_extension_events): Call
+       _gdk_input_wintab_init_check() here instead.
+
 2005-02-02  Ivan, Wong Yat Cheung  <email@ivanwong.info>
 
        * gdk/win32/gdkselection.c: Use a FIFO list for storing GdkSelProp
index 04f5c86a73f36c71f3260de9d3c5039c9e539fa2..74841d4f8460c8156433588953f64d90e2b5530c 100644 (file)
@@ -1,3 +1,24 @@
+2005-02-02  Tor Lillqvist  <tml@novell.com>
+
+       Implement lazy extended input initialization on Win32, by Robert
+       Ögren. Fixes #163163, possibly #162334. Lazy initialization would
+       be a good idea in any case even if it didn't fix any visible
+       problems, though.
+
+       The Wacom tablet driver seems to get confused if Wintab is
+       initialized but no window is shown before the process exits. This
+       is the case for some GIMP plug-ins, for instance. 
+
+       * gdk/win32/gdkinput-win32.c (_gdk_input_wintab_init_check): Made
+       non-static (and renamed).
+       (_gdk_input_init): Don't call _gdk_input_wintab_init_check().
+
+       * gdk/win32/gdkinput-win32.h: Declare _gdk_input_wintab_init_check().
+
+       * gdk/win32/gdkinput.c (gdk_devices_list,
+       gdk_display_list_devices, gdk_input_set_extension_events): Call
+       _gdk_input_wintab_init_check() here instead.
+
 2005-02-02  Ivan, Wong Yat Cheung  <email@ivanwong.info>
 
        * gdk/win32/gdkselection.c: Use a FIFO list for storing GdkSelProp
index 04f5c86a73f36c71f3260de9d3c5039c9e539fa2..74841d4f8460c8156433588953f64d90e2b5530c 100644 (file)
@@ -1,3 +1,24 @@
+2005-02-02  Tor Lillqvist  <tml@novell.com>
+
+       Implement lazy extended input initialization on Win32, by Robert
+       Ögren. Fixes #163163, possibly #162334. Lazy initialization would
+       be a good idea in any case even if it didn't fix any visible
+       problems, though.
+
+       The Wacom tablet driver seems to get confused if Wintab is
+       initialized but no window is shown before the process exits. This
+       is the case for some GIMP plug-ins, for instance. 
+
+       * gdk/win32/gdkinput-win32.c (_gdk_input_wintab_init_check): Made
+       non-static (and renamed).
+       (_gdk_input_init): Don't call _gdk_input_wintab_init_check().
+
+       * gdk/win32/gdkinput-win32.h: Declare _gdk_input_wintab_init_check().
+
+       * gdk/win32/gdkinput.c (gdk_devices_list,
+       gdk_display_list_devices, gdk_input_set_extension_events): Call
+       _gdk_input_wintab_init_check() here instead.
+
 2005-02-02  Ivan, Wong Yat Cheung  <email@ivanwong.info>
 
        * gdk/win32/gdkselection.c: Use a FIFO list for storing GdkSelProp
index a03c1024dfe5c2efd56759ad4c623ad66fb6f898..366979f2d4fa1a12e5b19f565a858be0207f9c46 100644 (file)
@@ -71,9 +71,9 @@ static GdkInputWindow *gdk_input_window_find_within (GdkWindow *window);
 
 static GdkDevicePrivate *gdk_input_find_dev_from_ctx (HCTX hctx,
                                                      UINT id);
-static GList     *wintab_contexts;
+static GList     *wintab_contexts = NULL;
 
-static GdkWindow *wintab_window;
+static GdkWindow *wintab_window = NULL;
 
 #endif /* HAVE_WINTAB */
 
@@ -204,9 +204,10 @@ print_lc(LOGCONTEXT *lc)
 
 #endif
 
-static void
-gdk_input_wintab_init (void)
+void
+_gdk_input_wintab_init_check (void)
 {
+  static gboolean wintab_initialized = FALSE;
   GdkDevicePrivate *gdkdev;
   GdkWindowAttr wa;
   WORD specversion;
@@ -219,7 +220,11 @@ gdk_input_wintab_init (void)
   int devix, cursorix;
   char devname[100], csrname[100];
 
-  _gdk_input_devices = NULL;
+  if (wintab_initialized)
+    return;
+  
+  wintab_initialized = TRUE;
+  
   wintab_contexts = NULL;
 
   if (!_gdk_input_ignore_wintab &&
@@ -1276,7 +1281,13 @@ _gdk_input_init (GdkDisplay *display)
 
   _gdk_init_input_core (display);
 #ifdef HAVE_WINTAB
-  gdk_input_wintab_init ();
+#ifdef WINTAB_NO_LAZY_INIT
+  /* Normally, Wintab is only initialized when the application performs
+   * an action that requires it, such as enabling extended input events
+   * for a window or enumerating the devices.
+   */
+  _gdk_input_wintab_init_check ();
+#endif /* WINTAB_NO_LAZY_INIT */
 #endif /* HAVE_WINTAB */
 
   _gdk_input_devices = g_list_append (_gdk_input_devices, display->core_pointer);
index 0e79d23a27e49aa2c6c8565ec560a34cef887f6c..12da3e87be2b79df6c22b5d5c733607366889674 100644 (file)
@@ -166,4 +166,8 @@ gboolean         _gdk_device_get_history     (GdkDevice         *device,
                                              GdkTimeCoord    ***events,
                                              gint              *n_events);
 
+#ifdef HAVE_WINTAB
+void           _gdk_input_wintab_init_check (void);
+#endif /* HAVE_WINTAB */
+
 #endif /* __GDK_INPUT_WIN32_H__ */
index 68d215ffca1d66c6eee9602f5744cb44d9cac426..a2c71bb85ce0ab64e93aabcb6a6b3b73cd20ed01 100644 (file)
@@ -119,12 +119,18 @@ gdk_device_get_type (void)
 GList *
 gdk_devices_list (void)
 {
+#ifdef HAVE_WINTAB
+  _gdk_input_wintab_init_check ();
+#endif /* HAVE_WINTAB */
   return _gdk_input_devices;
 }
 
 GList *
 gdk_display_list_devices (GdkDisplay *dpy)
 {
+#ifdef HAVE_WINTAB
+  _gdk_input_wintab_init_check ();
+#endif /* HAVE_WINTAB */
   return _gdk_input_devices;
 }
 
@@ -270,6 +276,9 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
 
   if (mask != 0)
     {
+#ifdef HAVE_WINTAB
+      _gdk_input_wintab_init_check ();
+#endif /* HAVE_WINTAB */
       iw = g_new(GdkInputWindow,1);
 
       iw->window = window;